package com.whh.permission.service.serviceImpl;

import com.whh.permission.dao.IMenuDao;
import com.whh.permission.po.Menu;
import com.whh.permission.po.NavNode;
import com.whh.permission.po.Node;
import com.whh.permission.po.RoleMenu;
import com.whh.permission.service.IMenuService;
import com.whh.permission.util.TreeBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class MenuServiceImpl implements IMenuService {
    @Autowired
    private TreeBuilder treeBuilder;
    @Resource
    private IMenuDao iMenuDao;
    @Override
    public List<Menu> queryMenuAll() {
        return iMenuDao.queryMenuAll();
    }

    @Override
    public void addMenu(Menu menu) {
        iMenuDao.addMenu(menu);
    }

    @Override
    public void deleteMenuById(Integer id) {
        iMenuDao.deleteMenuById(id);
    }

    @Override
    public Menu queryMenuById(Integer id) {
        return iMenuDao.queryMenuById(id);
    }

    @Override
    public void updateMenuSubmit(Menu menu) {
        iMenuDao.updateMenuSubmit(menu);
    }

    @Override
    public List<RoleMenu> queryMenuByRoleId(Integer roleId) {
        return iMenuDao.queryMenuByRoleId(roleId);
    }

    @Override
    public List<Node> queryMenuTree() {
        return iMenuDao.queryMenuTree();
    }
    @Override
    public List<NavNode> queryNavNodeListTree(Integer id) {
        return iMenuDao.queryNavNodeListTree(id);
    }

    @Override
    public List<Menu> isChild(Integer id) {
        return iMenuDao.isChild(id);
    }

}
